hostapd: allow ubus ban client address to be a broadcast address
authorRany Hany <[email protected]>
Thu, 1 May 2025 17:06:20 +0000 (17:06 +0000)
committerRobert Marko <[email protected]>
Mon, 8 Dec 2025 16:26:07 +0000 (17:26 +0100)
This will allow del_client with ban_time on a broadcast address
to also ban all clients temporarily.

Signed-off-by: Rany Hany <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/18670
Signed-off-by: Robert Marko <[email protected]>
package/network/services/hostapd/src/src/ap/ubus.c

index 6c23078a6940ee16d275f03f0d8742c1267f8c9f..c1d68c34ff29a06eb97946afa81b656f693e8d8d 100644 (file)
@@ -1849,6 +1849,7 @@ ubus_event_cb(struct ubus_notify_request *req, int idx, int ret)
 int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req)
 {
        struct ubus_banned_client *ban;
+       const u8 bcast[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
        const char *types[HOSTAPD_UBUS_TYPE_MAX] = {
                [HOSTAPD_UBUS_PROBE_REQ] = "probe",
                [HOSTAPD_UBUS_AUTH_REQ] = "auth",
@@ -1867,6 +1868,10 @@ int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_req
        if (ban)
                return WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA;
 
+       ban = avl_find_element(&hapd->ubus.banned, bcast, ban, avl);
+       if (ban)
+               return WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA;
+
        if (!hapd->ubus.obj.has_subscribers)
                return WLAN_STATUS_SUCCESS;